package com.demo.spring.formework.aop.aspect;

import com.demo.spring.formework.aop.QBMethodInvocation;

import java.lang.reflect.Method;

public class QBMethodBeforeAdvice extends QBAbstractAspectJAdvice implements QBAdvise,QBMethodInterceptor{

    private QBJoinPoint joinPoint;

    public QBMethodBeforeAdvice(Method aspectMethod, Object aspectTarget) {
        super(aspectMethod, aspectTarget);
    }

    public void before(Method method) throws Throwable {
        invokeAdviceMethod(this.joinPoint,null,null);
    }

    public Object invoke(QBMethodInvocation mi) throws Throwable {
        this.joinPoint = mi;
        this.before(mi.getMethod());
        return mi.proceed();
    }
}
